﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace mozhi.smarterp.Business.Purchases
{
    /// <summary>
    /// 采购订单和入库单关联关系
    /// </summary>
    public class PurchaseOrderReceipt : AuditedAggregateRoot<Guid> ,IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public Guid OrderId { get; private set; }

        public Guid OrderItemId { get; private set; }

        public Guid ReceiptId { get; private set; }

        public Guid ReceiptItemId { get; private set; }
        

        private PurchaseOrderReceipt() { }

        public PurchaseOrderReceipt(Guid id, Guid orderId, Guid orderItemId, Guid receiptId, Guid receiptItemId)
        {
            Id = id;
            OrderId = orderId;
            OrderItemId = orderItemId;
            ReceiptId = receiptId;
            ReceiptItemId = receiptItemId;

            Validate();
        }

        #region
        private void Validate()
        {
            Check.NotDefaultOrNull<Guid>(OrderId, nameof(OrderId));
            Check.NotDefaultOrNull<Guid>(OrderItemId, nameof(OrderItemId));

            Check.NotDefaultOrNull<Guid>(ReceiptId, nameof(ReceiptId));
            Check.NotDefaultOrNull<Guid>(ReceiptItemId, nameof(ReceiptItemId));
        }
        #endregion
    }

    public class PurchaseOrderReceiptItem : Entity<Guid>, IMultiTenant
    {
        public Guid? TenantId { get; private set; }

        public Guid OrderItemId { get; private set; }

        public Guid ReceiptItemId {  get; private set; }
    }
}
